package com.shi.controller;

import com.shi.entity.CollectionVO;
import com.shi.entity.ShiVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.shi.service.CollectionService;
import com.shi.entity.Collection;

/**
 * Collection的路由接口服务
 * 
 * @author 
 *
 */
@RestController
@RequestMapping("collect")
public class CollectionController {

	/** CollectionService服务 */
	@Autowired
	private CollectionService collectionService;
	
	/**
	 * 查询所有Collection数据的方法
	 * @param value
	 * @return
	 */
	@GetMapping(value = "/list", produces = {"application/json;charset=UTF-8"})
	public String find(CollectionVO value) {
		return collectionService.find(value);
	}

	//关联查询
	@GetMapping(value = "/myCollections", produces = {"application/json;charset=UTF-8"})
	public String myCollections( ShiVO value) {
		return collectionService.myCollections(value);
	}
	/**
	 * 插入Collection属性不为空的数据方法
	 * @param id
	 * @return
	 */
	@PostMapping(value = "/save", produces = {"application/json;charset=UTF-8"})
	public String save(@RequestBody Collection value) {

		return collectionService.saveNotNull(value);
	}
	
}
